import torch
import torch.nn as nn

class SimpleConvNet(nn.Module):
    def __init__(self):
        super(SimpleConvNet, self).__init__()
        self.conv1 = nn.Conv2d(1, 6, kernel_size=5)

    def print_conv_kernels(self):
        kernels = self.conv1.weight
        for i in range(kernels.size(0)):
            print(f"Kernel {i + 1}:")
            print(kernels[i].squeeze().detach().numpy())

# 创建模型实例
model = SimpleConvNet()

# 打印卷积核
model.print_conv_kernels()